package com.bigknow.appstore.proxy.util;

import com.bigknow.appstore.proxy.entity.TCLog;
import com.bigknow.appstore.proxy.vo.ClientErrorCallTimesVo;
import com.bigknow.appstore.proxy.vo.RequestVo;

import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 所有变量存储的地方
 * Created by chaos on 2016/6/13.
 */
public class HandlerVariables {

    public static final Map<String, ArrayBlockingQueue> acks = new ConcurrentHashMap<>();

    public static final Map<String,RequestVo> lastRequestVos = new ConcurrentHashMap<>();

    /**
     * 每次请求的当前的Request信息
     */
    public static final ThreadLocal<RequestVo> currentRequestVoLocal = new ThreadLocal();

    /**
     * 当代理创建到目标服务端的连接的时候将当次的requestVo设置进去，这样方便response中
     * 了解request信息
     * key = channelId;
     */
    public static final Map<String,RequestVo> requestVoForCurrentResponse = new ConcurrentHashMap<>();

    /**
     * 记录客户端错误访问记录
     * key = client hostAddress(ip);
     */
    public static final Map<String,ClientErrorCallTimesVo> clientErrorCallTimesMap = new ConcurrentHashMap<>();

}